<?php 
$this->pageTitle = 'Dispatch By Tech Report';
?>

<center><h2>QSI, INC</h2>
<h1>Dispatch By Tech Report</h1>
<h3>
	<?php if($model->startDate!=null):?>
		Start Date: <?php echo DateHelper::convertDate('m-d-Y',$model->startDate); ?> 
	<?php endif;?>

	<?php if($model->endDate!=null):?>
		End Date <?php echo DateHelper::convertDate('m-d-Y',$model->endDate); ?></h3>
	<?php endif; ?>
</center>

<?php 
$table = new CI_Table();
$table->set_template(array(
	'table_open'=>'<table width="100%">'
));
$table->set_heading(array(
	'Dispatch',	
	'Department',
	'Technician',
	'Status',
	'Start Date',
	'Start Time',
	'End Date',
	'End Time',	
));

foreach($dispatchList as $dispatch){
	$table->add_row(array(
		$dispatch->dispatch,
		$dispatch->department,
		$dispatch->lastestTech->employee->firstname.' '.$dispatch->lastestTech->employee->lastname,
		$dispatch->lastestTech->status,
		$dispatch->lastestTech->startdate,
		$dispatch->lastestTech->starttime,
		$dispatch->lastestTech->enddate,
		$dispatch->lastestTech->endtime
	));
}
echo $table->generate();
?>
